
#include "iostream"
#include "vector"
#include "unordered_map"
#include "algorithm"
#include "string"
#include "list"
class Solution{
public:
};


int main() {
//    std::list<int> list1;
//    int c=0;int b=0;
////    bool first= true;
    int a;
    std::string max;
    std::string s;
    while(1){
        char a=std::cin.get();
        if(a==EOF||a=='\n'){
            if(s.size()>max.size()){
                max=s;
            }
            printf("%d ",max.size());

            std::cout<<max<<std::endl;

            s.clear();
            max.clear();
            if(a==EOF){
                break;
            }
        }else if(a==' '){
            if(s.size()>max.size()){
                max=s;
            }
            s.clear();
        }else if((a>='a'&&a<='z')||(a>='A'&&a<='Z')){
            s+=a;
        }
    }
    return 0;
}

